/*
 * @Author: Tab
 * @Date: 2021-04-25 13:42:23
 * @Last Modified by: Tab
 * @Last Modified time: 2021-04-25 13:49:16
 */
const shelljs = require('shelljs');
const application = shelljs.exec('cd ..');

// git add .
application.exec('git add .');

// commit
const commitResult = application.exec('git-cz');
if (commitResult.code !== 0) {
    console.log('There are no documents to submit');
    process.exit();
}

// git pull
application.exec('git pull');

// git status
const statusResult = application.exec('git status');
if (statusResult.code !== 0) {
    console.log('File Conflicts');
    process.exit();
}

// git push
const pushResult = application.exec('git push');
if (pushResult.code === 0) {
    console.log('Code submitted successfully!');
    process.exit();
}
